package com.kamkor.interviewer.client;


import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.RootPanel;
import com.kamkor.interviewer.client.security.Authentication;
import com.kamkor.interviewer.client.security.InterviewedAuthentication;
import com.kamkor.interviewer.client.security.InterviewerAuthentication;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 * 
 * @author kamkor
 */
public class Interviewer implements EntryPoint {
	/**
	 * The message displayed to the user when the server cannot be reached or
	 * returns an error.
	 */
	private static final String SERVER_ERROR = "An error occurred while "
			+ "attempting to contact the server. Please check your network "
			+ "connection and try again.";
	
	public static LocaleConstants constants = GWT.create(LocaleConstants.class);

	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {	
		InterviewServiceAsync interviewRpcService = GWT.create(InterviewService.class);
		HandlerManager eventBus = new HandlerManager(null);
		Authentication interviewerAuthentication = new InterviewerAuthentication(interviewRpcService);
		Authentication interviewedAuthentication = new InterviewedAuthentication(interviewRpcService);
		AppController app = new AppController(eventBus, interviewRpcService, interviewerAuthentication, interviewedAuthentication);
		app.go(RootPanel.get());
		RootPanel loading = RootPanel.get("loading");;
		loading.setVisible(false);
	}
}
